// 宽泛类型
let a: string = "chengzhu";

// 值类型，下行报错，因为b的值只能是成竹
// let b: "成竹" = "张云";

// 值类型，正确
let b: "成竹" = "成竹";

console.log(a);
console.log(b);

// 不适用as const断言，c是宽泛类型
let c = true;
// 使用as const断言，c是值类型
let c = true as const;

let name: string = "成竹";
let company: string = "xqny";
let age: number = 18;
const arr1 = [name, age];
console.log(arr1);

// 使用as const断言后，数组变成元组
const arr2 = [name, age, "test", true] as const;
console.log(arr2);

const obj = {
  name: "chengzhu",
} as const;
console.log(obj);
¡